package com.marver.common.filter;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

public class TokenAuthorFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
            throws IOException, ServletException {
        HttpServletRequest httpRequest = (HttpServletRequest)request;
        //备份HttpServletRequest。解決ServletInputStream重复读取问题
        MyRequestWrapper requestWrapper = new MyRequestWrapper(httpRequest);
        chain.doFilter(requestWrapper,response);
    }

    @Override
    public void destroy() {
        // TODO Auto-generated method stub
    }
}  
